package com.pinc.wacow;

import java.util.HashMap;

import android.content.Context;
import android.database.Cursor;

public abstract class Category_Name {
	private static DBClass dbHelper;
	private static Cursor mCursor;
	private static HashMap<Long, String> items; 

	public static void init(Context context)
	{
		dbHelper = new DBClass(context);
		items = new HashMap<Long, String>();
		items.clear();

		mCursor = dbHelper.getRecord(DBClass.TABLE_NAME_CATEGORY, null, null, "_id DESC", null);
		if (mCursor.moveToFirst())
		{
			do{
				items.put(new Long(mCursor.getInt(mCursor.getColumnIndex("_id"))),
						mCursor.getString(mCursor.getColumnIndex(DBClass.COL_QCTG_NAME)));
			}while(mCursor.moveToNext());
		}
		mCursor.close();
		dbHelper.mDB.close();
	}

	public static String getCategoryName(long id)
	{
		return items.get(id);
	}
}
